<template>
  <el-card shadow="never" class="aui-card--fill">
    <div class="mod-demo__hzmemberwalletflow}">
      <h1>总计:{{totalNum}}</h1>
      <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
        <el-form-item>
          <el-input v-model="dataForm.userName" placeholder="pc账号" clearable></el-input>
        </el-form-item>
        <el-form-item>
          <el-input v-model="dataForm.remark" placeholder="收益链接" clearable></el-input>
        </el-form-item>
        <el-form-item>
          <el-select v-model="dataForm.flowType" :placeholder="$t('walletFlow.flowType')" clearable>
            <el-option :label="$t('walletFlow.flowType1')" :value="1"></el-option>
            <el-option :label="$t('walletFlow.flowType2')" :value="2"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-select v-model="dataForm.tradeType" :placeholder="$t('walletFlow.tradeType')" clearable>
            <el-option :label="$t('walletFlow.tradeType1')" :value="1"></el-option>
            <el-option :label="$t('walletFlow.tradeType2')" :value="2"></el-option>
            <el-option :label="$t('walletFlow.tradeType3')" :value="3"></el-option>
            <el-option :label="$t('walletFlow.tradeType4')" :value="4"></el-option>
            <el-option :label="$t('walletFlow.tradeType5')" :value="5"></el-option>
            <el-option :label="$t('walletFlow.tradeType6')" :value="6"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-date-picker
                  v-model="dataForm.chooseDate"
                  type="date"
                  value-format="yyyy-MM-dd"
                  placeholder="选择日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item>
          <el-button @click="getData()">{{ $t('query') }}</el-button>
        </el-form-item>
      </el-form>
      <el-table v-loading="dataListLoading" :data="dataList" border @selection-change="dataListSelectionChangeHandle" style="width: 100%;">
        <el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
        <!--<el-table-column prop="id" label="" header-align="center" align="center"></el-table-column>-->
        <el-table-column prop="userName" label="pc账号" header-align="center" align="center"></el-table-column>
        <el-table-column prop="flowType" label="流向" header-align="center" align="center">
        <template slot-scope="scope">
          <el-tag v-if="scope.row.flowType == 1" size="small" type="success">流入</el-tag>
          <el-tag v-if="scope.row.flowType == 2" size="small" type="warning">流出</el-tag>
        </template>
        </el-table-column>
        <el-table-column prop="tradeType" label="流动类型" header-align="center" align="center">
        <template slot-scope="scope">
          <el-tag v-if="scope.row.tradeType == 1" size="small" type="success">购买</el-tag>
          <el-tag v-if="scope.row.tradeType == 2" size="small" type="warning">提现</el-tag>
          <el-tag v-if="scope.row.tradeType == 3" size="small" type="warning">收益</el-tag>
          <el-tag v-if="scope.row.tradeType == 4" size="small" type="success">充值</el-tag>
          <el-tag v-if="scope.row.tradeType == 5" size="small" type="danger">提现失败</el-tag>
          <el-tag v-if="scope.row.tradeType == 6" size="small" type="success">激活</el-tag>
        </template>
        </el-table-column>
        <el-table-column prop="num" label="数量" header-align="center" align="center"></el-table-column>
        <el-table-column prop="remark" label="链接" header-align="center" align="center"></el-table-column>
        <el-table-column prop="createTime" label="" header-align="center" align="center"></el-table-column>
        <!--<el-table-column prop="remark" label="" header-align="center" align="center"></el-table-column>-->
        <!--<el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="150">-->
          <!--<template slot-scope="scope">-->
            <!--<el-button v-if="$hasPermission('demo:hzmemberwalletflow:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">{{ $t('update') }}</el-button>-->
            <!--<el-button v-if="$hasPermission('demo:hzmemberwalletflow:delete')" type="text" size="small" @click="deleteHandle(scope.row.id)">{{ $t('delete') }}</el-button>-->
          <!--</template>-->
        <!--</el-table-column>-->
      </el-table>
      <el-pagination
        :current-page="page"
        :page-sizes="[10, 20, 50, 100]"
        :page-size="limit"
        :total="total"
        layout="total, sizes, prev, pager, next, jumper"
        @size-change="pageSizeChangeHandle"
        @current-change="pageCurrentChangeHandle">
      </el-pagination>
      <!-- 弹窗, 新增 / 修改 -->
      <!--<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>-->
    </div>
  </el-card>
</template>

<script>
import mixinViewModule from '@/mixins/view-module'
export default {
  mixins: [mixinViewModule],
  data () {
    return {
      mixinViewModuleOptions: {
        getDataListURL: '/hz/walletFlow/page',
        getDataListIsPage: true,
        exportURL: '/demo/hzmemberwalletflow/export',
        deleteURL: '/demo/hzmemberwalletflow',
        getTotalNum: '/hz/walletFlow/getTotalNum',
        deleteIsBatch: true
      },
      dataForm: {
          userName: null,
          flowType: null,
          tradeType:null,
          remark:null,
          chooseDate: null
      },
      totalNum : 0

    }
  },
  components: {
  },
  created () {
      this.queryNum();
    },
  methods: {
        // 获取信息
        queryNum() {
            this.$http.get(
                this.mixinViewModuleOptions.getTotalNum,
                {
                    params: {
                        ...this.dataForm
                    }
                }
            ).then(({ data: res }) => {
                if (res.code !== 0) {
                    this.data.totalNum = 0
                    return this.$message.error(res.msg)
                }
                this.totalNum =  res.data
            }).catch(() => {
                this.dataListLoading = false
            })
        },
      getData(){
            this.queryNum();
            this.getDataList();

      }
  }
}
</script>
